home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-17 | 1020 b | 57 lines | [TEXT/CWIE] |
- // TaskLife.h
-
- #ifndef TaskLife_h
- #define TaskLife_h
-
- #ifndef Completor_h
- #include "Completor.h"
- #endif
- #ifndef Deferer_h
- #include "Deferer.h"
- #endif
- #ifndef ApplicationTaskQueue_h
- #include "ApplicationTaskQueue.h"
- #endif
-
- class Task;
-
- class TaskLife
- {
- friend class Task;
-
- private:
- Task *volatile task;
- Completor completor;
- volatile bool complete;
-
- BoundMethod1< TaskLife, DeferredTaskTime > runDeferredCompletor;
- BoundMethod1< TaskLife, ApplicationTime > runApplicationCompletor;
-
- Deferer deferer;
- ApplicationTaskQueue::Link applicationLink;
-
- void QueueCompletor();
- void FinishTask();
-
- void RunCompletor( DeferredTaskTime );
- void RunCompletor( ApplicationTime );
-
- // not implemented:
- TaskLife( const TaskLife& );
- void operator=( const TaskLife& );
-
- public:
- TaskLife();
- ~TaskLife();
-
- void Launch( Task *, Completor = Completor() );
- void Kill();
-
- bool Complete() const { return complete; }
-
- void WaitForCompletion() const;
- void KillAndWait();
- };
-
- #endif
-